#version 330 core
// vim: ft=glsl
layout(points) in;
layout(triangle_strip, max_vertices=4) out;

in geometry
{
	float radius;
	vec4 color;
} g[];

out fragment
{
	out vec4 color;
	out vec2 coord;
} f;

uniform vec2 upixsize;

vec2 r = g[0].radius * upixsize;
vec2 p = gl_in[0].gl_Position.xy;

void vertex(float x, float y)
{
	f.coord = vec2(x, y);
	gl_Position.xy = p + r*f.coord;
	EmitVertex();
}

void main()
{
	gl_Position.zw = vec2(0, 1);
	f.color = g[0].color;

	vertex(-1, -1);
	vertex(-1, +1);
	vertex(+1, -1);
	vertex(+1, +1);
	EndPrimitive();
}

